<div id="antraste">
    <div class="antraste_pradzia"></div>
    <div class="antraste_content"><?php echo __('Works'); ?></div>
    <div class="antraste_pabaiga"></div>
    <?php if ($pager->haveToPaginate()): ?>
        <div class="antraste_pradzia"></div>
        <div class="antraste_content">
            <?php echo link_to(
                        $pager->getFirstPage()
                        , 'works/works?page='.$pager->getFirstPage()
                    ) ?>
        </div>
        <div class="antraste_content_selected">
            <?php echo link_to(
                        $pager->getPreviousPage()
                        , 'works/works?page='.$pager->getPreviousPage()
                    ) ?>
        </div>
        <div class="antraste_content_selected">
            <?php echo link_to(
                        $pager->getPage()
                        , 'works/works?page='.$pager->getPage()
                    ) ?>
        </div>
        <div class="antraste_content_selected">
            <?php echo link_to(
                        $pager->getNextPage()
                        , 'works/works?page='.$pager->getNextPage()
                    ) ?>
        </div>
        <div class="antraste_content">
            <?php echo link_to(
                        $pager->getLasttPage()
                        , 'works/works?page='.$pager->getLastPage()
                    ) ?>
        </div>
        <div class="antraste_pabaiga"></div>
    <?php endif; ?>
</div> 
<div class="textbox_content">
    <?php if($pager->getNbResults() > 0): ?>
    <?php /* @var $work Works */?>
        <?php foreach($pager->getResults() as $work ): ?>
            <div class="atlikti_projektai">
            <div id="atlikti_img">
                <?php echo image_tag($work->getFirstImage()?'gallery/tiny/'.$work->getFirstImage()->getUname(): 'blank.png'
                                , array('title' => $work->getName()
                                        , 'alt' => $work->getName()
                                        , 'width' => 135
                                        , 'height' => 94));?>
            </div>
            <?php echo link_to($work->getName()
                            , $work->getLinkTo()
                            , array('target' => '_blank'
                                , 'style' => 'padding-bottom:5px;'))?>
            <?php if(has_any_role_id(array(MyConstants::ROLE_ADMIN, MyConstants::ROLE_MODERATOR))): ?>
                <?php echo link_to(image_tag('pencil.png'
                                            , 'style="border:0px;"')
                                , 'works/edit?id=' . $work->getId()); ?>
            <?php endif;?><br />
            
            <?php echo $work->getDescription(); ?>
        </div>
        <div style="clear:both;"></div>
        <?php endforeach; ?>
    <?php else: ?>
        <?php echo __('No results'); ?>
    <?php endif; ?><br />
     <?php if(has_any_role_id(array(MyConstants::ROLE_ADMIN, MyConstants::ROLE_MODERATOR))): ?>
        <?php echo link_to(image_tag('add.png'
                                    , array('style' => 'border:0px;'
                                        , 'title' => __('add')))
                        , 'works/create?type=' . MyConstants::TYPE_WORKS); ?>
    <?php endif;?>
</div>